version: "3"

networks:
  chat-bot:

services:
  rabbitmq:
    image: rabbitmq:3-management
    container_name: rmq
    ports:
      - 5672:5672
      - 15672:15672
    networks:
      - chat-bot

  tg-bot:
    build: chat-bot-main/
    container_name: bot
    networks:
      - chat-bot
    restart: always
    links:
      - rabbitmq
      - db
    environment:
      BOT_TOKEN: ${BOT_TOKEN}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_HOST: ${MYSQL_HOST}
      MYSQL_PORT: ${MYSQL_PORT}
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}

  db:
    image: mysql:5.7
    container_name: db
    ports:
      - "32000:3306"
    networks:
      - chat-bot
    volumes:
      - ./db:/docker-entrypoint-initdb.d/:ro
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    container_name: phpmyadmin
    restart: always
    links:
      - db
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_USER: ${MYSQL_USER}
      PMA_PASSWORD: ${MYSQL_ROOT_PASSWORD}
    ports:
      - "8080:80"
    networks:
      - chat-bot
